﻿using BasicInformation.ApiRead.Application.Command.Device;
using BasicInformation.Domain;
using BasicInformation.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BasicInformation.ApiRead.Controllers
{
    /// <summary>
    /// 设备控制器——读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DeviceController : ControllerBase
    {
        private readonly IMediator mediator;

        public DeviceController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 设备管理查询接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<DeviceModel>> GetDevice([FromQuery]GetDeviceCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
